package com.hopu.blb_erp.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hopu.blb_erp.mapper.TShelvesMapper;
import com.hopu.blb_erp.entity.PageEntity;
import com.hopu.blb_erp.entity.TShelves;
import com.hopu.blb_erp.service.TShelvesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TShelvesServiceImpl extends ServiceImpl<TShelvesMapper, TShelves> implements TShelvesService {

    @Autowired
    private TShelvesMapper tShelvesMapper;


    @Override
    public PageEntity<TShelves> findPage(Integer current, Integer length,String shelvesNo,String date) {
        Integer count = tShelvesMapper.selectCount(shelvesNo,date);
        List<TShelves> tShelves = tShelvesMapper.selectPage((current - 1) * length, length,shelvesNo,date);
        PageEntity<TShelves> tShelvesPageEntity = new PageEntity<>();
        tShelvesPageEntity.setData(tShelves);
        tShelvesPageEntity.setCurrent(current);
        tShelvesPageEntity.setCount(count);
        return tShelvesPageEntity;
    }
//
    @Override
    public List<TShelves> findByWarehouseId(String warehouseId) {
        return tShelvesMapper.selectByWarehouseId(warehouseId);
    }

    @Override
    public List<TShelves> selectByWarehouseName(String warehouseId) {
        return tShelvesMapper.selectByWarehouseName(warehouseId);
    }
}
